getTextAsHTML

abstract fun getTextAsHTML(block: DesignBlock, from: Int = -1, to: Int = -1): String

Returns a range of a text block as HTML with its formatting, for the clipboard. The HTML states the color, background color, weight, italic, decorations, script style, case, font size and typeface of each run as inline CSS. It states the list style, list level and alignment of each paragraph. Other apps read it on paste, and replaceTextWithHTML reads every property back. The typeface applies only when a typeface of the scene holds its font file. The font size and the line height are CSS values, so other apps show them as the block does.

Return

the HTML, or an empty string for an empty range.

Parameters

block

the text block to read.

from

the start index of the range. If the value is negative and the block is being edited, this falls back to the start of the selection. Otherwise it falls back to the start of the entire text.

to

the index after the last character of the range. If the value is negative and the block is being edited, this falls back to the end of the selection. Otherwise it falls back to the end of the entire text.